<div class="page-header">
    <h2>{{form_title}}</h2>
</div>

<form name="issueForm" class="form-horizontal" ng-submit="save()" ng-show="issue">
    <div class="col-md-6">
        <div class="form-group"
             ng-class="{'has-error': issueForm.title.$dirty && issueForm.title.$invalid, 'has-success': issueForm.title.$dirty && !issueForm.title.$invalid}">
            <label for="issue-title" class="col-lg-2 control-label">Title</label>
            <div class="col-lg-6">
                <input id="issue-title" type="text" class="form-control" placeholder="Enter title"
                       name="title" ng-model="issue.issue_title" ng-required="true" ng-minlength="2"/>
          <span class="help-block"
                ng-show="issueForm.title.$invalid && (issueForm.$submitted || issueForm.title.$dirty)">
            Title is required
          </span>
            </div>
        </div>

        <div class="form-group">
            <label for="issue-summary" class="col-lg-2 control-label">Summary</label>
            <div class="col-lg-6">
                <textarea name="summary" ng-model="issue.summary"
                          class="form-control"
                          id="issue-summary" rows="5"></textarea>
            </div>
        </div>
        <div class="form-group">
            <div class="col-lg-offset-2 col-lg-6">
                <button ng-disabled="issueForm.$invalid" type="submit" class="btn btn-success" ng-hide="issue.issue_id">
                    <i class="icon-plus-sign"></i> Create
                </button>

                <button ng-disabled="issueForm.$invalid" type="submit" class="btn btn-primary" ng-show="issue.issue_id">
                    <i class="icon-save"></i> Update
                </button>

                <a href="" class="btn btn-danger"
                   ng-show="issue.issue_id"
                   ng-click="deleteIssue()"><i class="icon-trash"></i> Delete</a>

                <a href="#/issues" class="btn btn-warning">Cancel</a>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="form-group">
            <label for="project" class="col-lg-2 control-label">Project</label>
            <div class="col-lg-6">
            <select class="form-control" id="project" ng-model="issue.project" ng-options="project.project_id as project.title for project in projects"></select>
                </div>
        </div>

        <div class="form-group">
            <label for="priority" class="col-lg-2 control-label">Priority</label>
            <div class="col-lg-6">

            <select class="form-control" id="priority" ng-model="issue.priority">
                <option value="normal">Normal</option>
                <option value="outage"">System Outage</option>
            </select>
                </div>
        </div>

        <div class="form-group">
            <label for="assigned_to" class="col-lg-2 control-label">Assigned to</label>
            <div class="col-lg-6">

            <select class="form-control" id="assigned_to" ng-model="issue.assigned_to" ng-options="assignee.contact_id as assignee.fullname for assignee in assignees"></select>
                </div>
        </div>
    </div>
</form>
